﻿Ext.onReady(function () {

});

//检查登录
var CheckLogin = function () {
    if (document.getElementById("username").value == "") {
        Ext.Msg.alert("检查提示", "请输入用户名");
        return false;
    }
    if (document.getElementById("password").value == "") {
        Ext.Msg.alert("检查提示", "请输入密码");
        return false;
    }
    return true;
}

//提交
var SubmitLogin = function () {
    if (CheckLogin()) {
        var username = document.getElementById("username").value;
        var pass = document.getElementById("password").value;

        var re = new JsonRequest();
        re.params.UserAccount = username;
        re.params.Pass = pass;

        Ext.Ajax.request({
            url: Ext.getClassUrl('BaseManager.UserInfoView', 'Login'),
            jsonData: re,
            success: function (re, op) {
                var obj = Ext.decode(re.responseText);
                if (obj.ResponseObject != null) {
                    window.location = "Main.aspx";
                }
                else {
                    Ext.Msg.alert("登录失败", "用户名密码验证失败");
                }
            }
        });
    }
}

//关闭
var CloseLogin = function () {
    window.close();
}